<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function bubble(array){
            for (let i = 0; i < array.length; i++){
                for (let j = 0; j < array.length -i;j++){
                    if(array[j]>array[j+1]){
                    let tmp = array[j]
                    array[j] = array[j+1]
                    array[j+1] = tmp
                    }
                }
            }
            return array
        }
        console.log(bubble([9,6,13,111,-4]))
    </script>
</head>
<body>
    
</body>
</html>